namespace IntroEntityFramework.Migrations
{
    using IntroEntityFramework.Model;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<IntroEntityFramework.Models.ApplicationDbContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = false; //DO NOT CHANGE TO TRUE
        }

        protected override void Seed(IntroEntityFramework.Models.ApplicationDbContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
            context.Appointments.AddOrUpdate(
                    a => a.Description,
                    new Appointment() { Description = "Meet about JavaScript", UserWith = "Jeremy", TimeStart = DateTime.Now.AddDays(3), TimeEnd = DateTime.Now.AddDays(4), IsDeleted = false },
                    new Appointment() { Description = "Meet about C#", UserWith = "Jeremy", TimeStart = DateTime.Now.AddDays(2), TimeEnd = DateTime.Now.AddDays(3), IsDeleted = false },
                    new Appointment() { Description = "Meet about Angular", UserWith = "Jeremy", TimeStart = DateTime.Now.AddDays(1), TimeEnd = DateTime.Now.AddDays(2), IsDeleted = true },
                    new Appointment() { Description = "Meet about SQL", UserWith = "Jeremy", TimeStart = DateTime.Now.AddDays(4), TimeEnd = DateTime.Now.AddDays(5), IsDeleted = false }
                );
        }
    }
}